// import axios from 'axios'
import request from '@/utils/request'

export default {
  namespaced: true,
  state: {
    list: [],
  },
  getters: {},
  mutations: {
    setList(state, payload) {
      state.list = payload
    },
  },
  actions: {
    async getList(ctx) {
      const res = await request({
        method: 'GET',
        url: '/v1_0/articles',
        // 请求体数据
        // data: {},
        // 查询参数
        params: {
          channel_id: this.state.catagtory.curChannelId, // 当前频道id，是不是在 catagtory 子模块下
          timestamp: Date.now(),
        },
      })
      const { results } = res.data.data
      ctx.commit('setList', results)
    },
  },
}
